load("@npm//@bazel/typescript:index.bzl", "ts_library")

package(default_visibility = ["//:__subpackages__"])

ts_library(
    name = "hpke",
    srcs = [
        "aes_gcm_hpke_aead.ts",
        "hkdf_hpke_kdf.ts",
        "hpke_aead.ts",
        "hpke_context.ts",
        "hpke_kdf.ts",
        "hpke_kem.ts",
        "hpke_kem_encap_output.ts",
        "hpke_kem_private_key.ts",
        "hpke_util.ts",
        "nist_curves_hpke_kem.ts",
        "nist_curves_hpke_kem_private_key.ts",
    ],
    module_name = "tink-crypto/hybrid/internal/hpke",
    deps = [
        "//aead/internal",
        "//exception",
        "//subtle",
    ],
)

ts_library(
    name = "hpke_tests",
    testonly = True,
    srcs = [
        "aes_gcm_hpke_aead_tests.ts",
        "hkdf_hpke_kdf_test.ts",
        "hpke_util_test.ts",
        "nist_curves_hpke_kem_private_key_test.ts",
        "nist_curves_hpke_kem_test.ts",
        ":hpke_boringssl_test_vectors",
    ],
    deps = [
        ":hpke",
        "//exception",
        "//hybrid/internal/hpke/testing:hpke_test_utils",
        "//subtle",
        "//testing/internal",
        "@npm//@types/jasmine",
    ],
)

genrule(
    name = "hpke_boringssl_test_vectors",
    testonly = True,
    srcs = ["//testdata/testvectors:hpke_boringssl"],
    outs = [":hpke_boringssl_test_vectors.ts"],
    cmd = 'cat - $< <<<"export const HPKE_BORINGSSL_TEST_VECTORS =" >$@',
)
